<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <a href="https://www.baidu.com">百度</a>
  <script>
    const a = document.querySelector("a");
    a.addEventListener("click", function(e){
      // e:事件对象
      console.info(e);

      // 阻止浏览器的默认行为
      e.preventDefault();
    },
    { passive: true } // 阻止取消默认事件，如果这里设置了true，上面的e.preventDefault();方法就不会生效！！有点鸡肋呢？
    )
  </script>
</body>
</html>